/**
 * Copyright 2014 xiaojian
 *
 *
 * Create on 2015年4月30日 下午4:37:28
 */
package xj.toolkit.ebus.unit;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.state.ConnectionState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author <a href="mailto:caoxiaojian@wasu.cn">xiaojiancao</a>
 *
 */
public class ConnectionStateListener implements
		org.apache.curator.framework.state.ConnectionStateListener {

	private static final Logger logger = LoggerFactory
			.getLogger(ConnectionStateListener.class);

	@Override
	public void stateChanged(CuratorFramework client, ConnectionState newState) {

		switch (newState) {
		default: {
			break;
		}

		case RECONNECTED: {
			logger.info("Zookeeper state[RECONNECTED].");
			break;
		}

		case SUSPENDED: {
			logger.info("Zookeeper state[SUSPENDED].");
			break;
		}
		case LOST: {
			logger.info("Zookeeper state[LOST].");
			break;
		}
		}

	}

}
